﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// Pour en savoir plus sur le modèle d'élément Page vierge, consultez la page http://go.microsoft.com/fwlink/?LinkId=234238

namespace GIFPlayerSample
{
    /// <summary>
    /// Une page vide peut être utilisée seule ou constituer une page de destination au sein d'un frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {


        public string Pays
        {
            get { return (string)GetValue(PaysProperty); }
            set { SetValue(PaysProperty, value); myGifPlayer.Source = "/Assets/giphy.gif"; }
        }

        // Using a DependencyProperty as the backing store for Pays.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty PaysProperty =
            DependencyProperty.Register("Pays", typeof(string), typeof(string), new PropertyMetadata(0));

        

        public MainPage()
        {
            this.InitializeComponent();
            myGifPlayer.OnError += gifPlayer_OnError;
            //myGifPlayer.Source = "http://media.giphy.com/media/yv8iBjSfZs9IA/giphy.gif";

            Pays = "tralal";
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // gifPlayer.DrawNext();

            if (GifGrid.Visibility == Windows.UI.Xaml.Visibility.Collapsed)
                GifGrid.Visibility = Windows.UI.Xaml.Visibility.Visible;
            else if (GifGrid.Visibility == Windows.UI.Xaml.Visibility.Visible)
                GifGrid.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
        }

        void gifPlayer_OnError(GIFPlayer.GIFError error)
        {
            //throw new NotImplementedException();
            string test = "";
        }
    }
}
